import json


def deal_line(**kwargs):
    content = kwargs['line']

    content = content.replace('\\u', '')
    content = content.replace('\\', '')

    data = json.loads(content)

    return json.dumps(data, ensure_ascii=False)


def run_pipeline(**kwargs):
    file_name = kwargs['file_name']
    lines = []

    with open(file_name) as f:
        for line in f:
            content = deal_line(line=line)

            print(content)
            lines.append(content)

    with open(file_name, 'w') as g:
        for line in lines:
            g.write(line + '\n')


if __name__ == "__main__":
    run_pipeline(
        file_name="/Users/wjunshen/Downloads/queries-ms-marco.json"
    )
